#include <iostream>
using namespace std;

class Sample {
	private:
		int n;
	public:
		Sample(int i) : n(i) {}

		Sample &operator++() {
			++n;
			return *this;
		}

		Sample operator++(int) {
			Sample temp = *this;
			++(*this);
			return temp;
		}

		operator int() const {
			return n;
		}

		friend ostream &operator<<(ostream &os, const Sample &s) {
			os << s.n;
			return os;
		}
};

int main() {
	Sample s(5);
	cout << s << endl;
	cout << (s++) << endl;
	cout << (++s) << endl;
	cout << s << endl;
	return 0;
}